From 6730a005d1a14b5e3253eb2dd268d5bc5018f144 Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Wed, 6 Jan 2016 15:59:58 -0600 Subject: [PATCH] Revert "Hack up GPX writer to prepare for GGZ." This reverts commit e529697c7247b0df99c94e05c73045efb2ed5999. This was incomplete work for the new GGZ work that has the unfortunate side effect of breaking our GPX writer for any GPX write over 500K. Rolling this back for a probably respin of 1.5.3. --- gpx.cc | 46 +--------------------------------------------- gpx.h | 21 --------------------- 2 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 gpx.h diff --git a/gpx.cc b/gpx.cc index e5fa054c1..67e10158d 100644 --- a/gpx.cc +++ b/gpx.cc @@ -23,12 +23,10 @@ #include "cet_util.h" #include "garmin_fs.h" #include "garmin_tables.h" -#include "gpx.h" #include "src/core/logging.h" #include "src/core/file.h" #include "src/core/xmlstreamwriter.h" #include "src/core/xmltag.h" -#include "src/core/ziparchive.h" #include #include @@ -64,12 +62,9 @@ static short_handle mkshort_handle; static QString link_url; static QString link_text; static QString link_type; -static QString output_file_name; -static QList gpx_files_written_; static char* snlen = NULL; -static char* split = NULL; static char* suppresswhite = NULL; static char* urlbase = NULL; static route_head* trk_head; @@ -1232,33 +1227,9 @@ gpx_rd_deinit(void) cur_tag = NULL; } -// Secret accessor to return an array of file names that we have written. -QList GetGpxFilesWritten() { - return gpx_files_written_; -} - -// When we're writing multiple GPX files, get the output filename (which may -// have a path component) in the current sequence. -static QString GetOutFname(int seq) { - static const char* kNameToken = "__NUM__"; - - QString sequence = QString("%1").arg(seq); - QString s = output_file_name; - s.replace(kNameToken, sequence); - return s; -} - static void -gpx_wr_init(const char* ifname) +gpx_wr_init(const char* fname) { - QString fname = ifname; - if (output_file_name.isEmpty()) { - output_file_name = fname; - // Our first name is "one". - fname = GetOutFname(1); - } - gpx_files_written_.append(fname); - mkshort_handle = NULL; oqfile = new gpsbabel::File(fname); oqfile->open(QIODevice::WriteOnly | QIODevice::Text); @@ -1684,17 +1655,6 @@ gpx_waypt_pr(const Waypoint* waypointp) fs_xml* fs_gpx; garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */ - // If we're splitting files and the output buffer is approaching - // our split we close the file we were last writing and open a new - // one. - static const double kSplitPercent = 0.99; - if (oqfile->size() > atoi(split) * kSplitPercent) { - static int x = 2; // The first one is "one" automatically. - gpx_wr_deinit(); - QString fn = GetOutFname(x++); - gpx_wr_init(CSTR(fn)); - } - writer->writeStartElement("wpt"); writer->writeAttribute("lat", toString(waypointp->latitude)); writer->writeAttribute("lon", toString(waypointp->longitude)); @@ -1969,10 +1929,6 @@ arglist_t gpx_args[] = { "snlen", &snlen, "Length of generated shortnames", "32", ARGTYPE_INT, "1", NULL, NULL }, - { - "split", &split, "split wpts after this many bytes ", - "500000", ARGTYPE_INT, "1", NULL, NULL - }, { "suppresswhite", &suppresswhite, "No whitespace in generated shortnames", diff --git a/gpx.h b/gpx.h deleted file mode 100644 index f61cef875..000000000 --- a/gpx.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Access GPX data files. - - Copyright (C) 2002-2015 Robert Lipe, gpsbabel.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - */ -QList GetGpxFilesWritten(); -- 2.30.2